package metaphor.persistence.filter;

/**
 *
 * @author Mark Ashworth
 */
public class SQLFilterLanguage implements FilterLanguage {
	
	
	public String operator(Operator operator) {
		switch (operator) {
			case LIKE: return "like";
			case GT: return ">";
			case GE: return ">=";
			case LT: return "<";
			case LE: return "<=";
			case EQ: return "==";
			case NOT: return "!=";
			default: throw new IllegalArgumentException("The operator " + operator + " is not defined");
		}
	}
	
	
	public String logical(Logical logical) {
		switch (logical) {
			case AND: return "and";
			case OR: return "or";
			default: throw new IllegalArgumentException("The logical operator " + logical + " is not defined");		
		}
	}
	
	
	public String symbol(Symbol symbol) {
		switch (symbol) {
			case APOSTROPHE: return "'";
			default: throw new IllegalArgumentException("The symbol " + symbol + " is not defined");		
		}
	}
}
